package priorityQueue;

import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Random;

public class Test {
    public static void main(String[] args) {
        PriorityQueue<Integer> q = new PriorityQueue<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2 - o1;
            }
        });
        System.out.println(q.isEmpty());
        Random random = new Random(System.currentTimeMillis());

        for (int i = 0; i < 20; i++){
            q.offer(random.nextInt(100) + 1);
        }
        System.out.println(q.peek());
        System.out.println(q.isEmpty());

        while (!q.isEmpty()){
            System.out.print(q.poll() + " ");
        }
        System.out.println();
        System.out.println(q.isEmpty());
    }
}
